<template>
  <div class="aui-card--fill scroll-box card-box">
    <div v-if="isMain"
         class="mod-sys__menu pane-shell">
      <el-form :inline="true"
               @submit.native.prevent
               :model="dataForm"
               class="align-right"
               @keyup.enter.native="search">
        <!-- <el-form-item>
          <el-button type="primary"
                     plain
                     @click="platformConfiguration()">平台配置</el-button>
        </el-form-item> -->
      </el-form>
      <el-table v-loading="dataListLoading"
                :data="dataList"
                border
                @selection-change="dataListSelectionChangeHandle"
                @sort-change="dataListSortChangeHandle"
                style="width: 100%;">
        <el-table-column type="index"
                         label="序号"
                         header-align="center"
                         align="center"
                         width="50"></el-table-column>
        <el-table-column prop="sonName"
                         label="子系统名称"
                         show-overflow-tooltip
                         header-align="center"
                         align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.sonName === '0'">会务管理系统</span>
            <span v-if="scope.row.sonName === '1'">访客管理系统</span>
            <span v-if="scope.row.sonName === '2'">车辆管理系统</span>
            <span v-if="scope.row.sonName === '3'">宿舍管理系统</span>
            <span v-if="scope.row.sonName === '4'">门禁管理系统</span>
            <span v-if="scope.row.sonName === '5'">健身房管理系统</span>
            <span v-if="scope.row.sonName === '6'">物流车管理系统</span>
          </template>
        </el-table-column>
        <el-table-column prop="moudleName"
                         label="模块"
                         show-overflow-tooltip
                         header-align="center"
                         align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.moudleName === '0'">会议室预约</span>
            <span v-if="scope.row.moudleName === '1'">访客申请</span>
            <span v-if="scope.row.moudleName === '2'">用车申请</span>
            <span v-if="scope.row.moudleName === '3'">物流车来访申请</span>
            <span v-if="scope.row.moudleName === '4'">员工入住申请</span>
            <span v-if="scope.row.moudleName === '5'">员工调宿申请</span>
            <span v-if="scope.row.moudleName === '6'">临时入住登记</span>
            <span v-if="scope.row.moudleName === '7'">门禁申请</span>
            <span v-if="scope.row.moudleName === '8'">健身房申请</span>
            <span v-if="scope.row.moudleName === '9'">物流车申请</span>
            <span v-if="scope.row.moudleName === '11'">停车申请</span>
          </template>
        </el-table-column>
        <el-table-column prop="examineWay"
                         label="审批方式"
                         show-overflow-tooltip
                         header-align="center"
                         align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.examineWay === 10">系统</span>
            <span v-if="scope.row.examineWay === 1">泛微</span>
            <span v-if="scope.row.examineWay === 2">企业微信</span>
          </template>
        </el-table-column>
        <el-table-column :label="$t('handle')"
                         fixed="right"
                         header-align="center"
                         align="center"
                         width="180">
          <template slot-scope="scope">
            <el-button type="text"
                       size="small"
                       @click="detail(scope.row)">详情</el-button>
            <el-button type="text"
                       size="small"
                       v-if="$hasPermission('tb:examine:updateExamine')"
                       @click="edit(scope.row)">修改</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination :current-page="page"
                     :page-sizes="[10, 20, 50, 100]"
                     :total="total"
                     layout="total, sizes, prev, pager, next"
                     @size-change="pageSizeChangeHandle"
                     @current-change="pageCurrentChangeHandle">
      </el-pagination>
    </div>
    <platform-configuration v-else
                            @delHandle="delHandle" />
    <approval-set-update ref="addOrUpdate"
                         @callBack="getDataList" />
    <approval-set-detail ref="addOrUpdate1" />
  </div>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import formValidate from '@/mixins/form-validate'
import tableTemplate from '@/components/table-template'
import ApprovalSetUpdate from './approval-set-update.vue'
import ApprovalSetDetail from './approval-set-detail.vue'
import PlatformConfiguration from './platform-configuration.vue'
export default {
  mixins: [mixinViewModule, formValidate],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/tb/examine/queryPage',
        getDataListIsPage: true
      },
      dataList: [],
      isMain: true,
      loading: null,
      dataForm: {}
    }
  },
  mounted () {
  },
  components: {
    tableTemplate,
    ApprovalSetUpdate,
    PlatformConfiguration,
    ApprovalSetDetail
  },
  computed: {
  },
  methods: {
    edit (data) {
      this.openDialog('addOrUpdate', data)
    },
    detail (data) {
      this.openDialog('addOrUpdate1', data)
    },
    // 页面隐藏
    delHandle () {
      this.isMain = true
      this.getDataList()
    },
    // 平台设置
    platformConfiguration () {
      this.isMain = false
    }
  }
}
</script>
<style lang="scss" scoped></style>
